import {useMap} from 'react-use';
import React from 'react';

const Demo = () => {
	const [map, {set, setAll, remove, reset}] = useMap({
		hello: 'there',
	});

	return (
		<div>
			<p>hello</p>
			<button type="button" onClick={() => set(String(Date.now()), new Date().toJSON())}>Add</button>
			<button type="button" onClick={() => reset()}>Reset</button>
      		<button type="button" onClick={() => setAll({ hello: 'new', data: 'data' })}>Set new data</button>
      		<button type="button" onClick={() => remove('hello')} disabled={!map.hello}>Remove hello</button>
      		<pre>{JSON.stringify(map, null, 2)}</pre>
		</div>
	);
};

export default Demo;
